606fbea53499bc53b13988b6bb2d58115a4b9535,app-fabric/src/main/java/com/continuuity/internal/app/services/DefaultAppFabricService.java,DefaultAppFabricService,deleteMetrics,#String#String#,1102
Before Change
private void deleteMetrics(String account, String application) throws IOException {
Discoverable discoverable = this.discoveryServiceClient.discover(Constants.SERVICE_METRICS).iterator().next();
String url = String.format("http://%s:%d/metrics/app/%s",
discoverable.getSocketAddress().getHostName(),
discoverable.getSocketAddress().getPort(),
After Change
private void deleteMetrics(String account, String application) throws IOException {
Iterable<Discoverable> discoverables = this.discoveryServiceClient.discover(Constants.SERVICE_METRICS);
Discoverable discoverable = new TimeLimitEndpointStrategy(new RandomEndpointStrategy(discoverables),
DISCOVERY_TIMEOUT_SECONDS, TimeUnit.SECONDS).pick();
if (discoverable == null) {
LOG.error("Fail to get any metrics endpoint for deleting metrics.");